﻿function bandoneon(mddBarContent, mddBar, mddContentText, mddLineBreak) {

    if (!mddBarContent.length || !mddBar.length) return;

    mddBarContent.hide();
    mddBar.click(function (e) {


        mddBar.removeClass("mddBarCurrent");
	    mddBarContent.not(":hidden").slideUp('fast');
		
		var current = $(this);
		$(this).next().not(":visible").slideDown('fast',function() {
		    current.addClass("mddBarCurrent");
		   if (e.originalEvent != undefined) 
  { 
    jump($(".mddBarCurrent"));
  } 
		    
		});
	});
}

function jump() {
    var posTop = $(".mddBarCurrent").offset().top;
		var posTop10 = posTop-10;
		$(window).scrollTop(posTop10);
}

$(document).ready(function () {
    bandoneon($(".mddBarContent"),
    $(".mddBar"),
    $(".mddBar .mddContentText").removeClass("mddContentText"),
    $(".mddBar .mddLineBreak").remove());
    
    $(".contentMain .mddBar").first().click(); 
});
